package com.ruoyi.web.controller.devices;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TiktokUserInfo;
import com.ruoyi.system.service.ITiktokUserInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * TikTok用户综合信息Controller
 * 
 * @author ruoyi
 * @date 2025-04-19
 */
@RestController
@RequestMapping("/system/tiktip")
public class TiktokUserInfoController extends BaseController
{
    @Autowired
    private ITiktokUserInfoService tiktokUserInfoService;

    /**
     * 查询TikTok用户综合信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:tiktip:list')")
    @GetMapping("/list")
    public TableDataInfo list(TiktokUserInfo tiktokUserInfo)
    {
        startPage();
        List<TiktokUserInfo> list = tiktokUserInfoService.selectTiktokUserInfoList(tiktokUserInfo);
        return getDataTable(list);
    }

    /**
     * 导出TikTok用户综合信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:tiktip:export')")
    @Log(title = "TikTok用户综合信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TiktokUserInfo tiktokUserInfo)
    {
        List<TiktokUserInfo> list = tiktokUserInfoService.selectTiktokUserInfoList(tiktokUserInfo);
        ExcelUtil<TiktokUserInfo> util = new ExcelUtil<TiktokUserInfo>(TiktokUserInfo.class);
        util.exportExcel(response, list, "TikTok用户综合信息数据");
    }

    /**
     * 获取TikTok用户综合信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:tiktip:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tiktokUserInfoService.selectTiktokUserInfoById(id));
    }

    /**
     * 新增TikTok用户综合信息
     */
    @PreAuthorize("@ss.hasPermi('system:tiktip:add')")
    @Log(title = "TikTok用户综合信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TiktokUserInfo tiktokUserInfo)
    {
        return toAjax(tiktokUserInfoService.insertTiktokUserInfo(tiktokUserInfo));
    }

    /**
     * 修改TikTok用户综合信息
     */
    @PreAuthorize("@ss.hasPermi('system:tiktip:edit')")
    @Log(title = "TikTok用户综合信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TiktokUserInfo tiktokUserInfo)
    {
        return toAjax(tiktokUserInfoService.updateTiktokUserInfo(tiktokUserInfo));
    }

    /**
     * 删除TikTok用户综合信息
     */
    @PreAuthorize("@ss.hasPermi('system:tiktip:remove')")
    @Log(title = "TikTok用户综合信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tiktokUserInfoService.deleteTiktokUserInfoByIds(ids));
    }
}
